package com.hz.edu.service.impl;

import com.hz.edu.mapper.UserCourseMapper;
import com.hz.edu.model.entity.UserCourseEntity;
import com.hz.edu.service.TeacherService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class TeacherServiceImpl implements TeacherService {

    @Resource
    UserCourseMapper userCourseMapper;

    @Override
    public int checkScore(Integer courseId, Integer studentId, Integer score) {
        UserCourseEntity userCourseEntity = userCourseMapper.selectByCourseAndStudentId(courseId, studentId);
        if (userCourseEntity == null) {
            return 0;
        }
        return userCourseMapper.updateScore(courseId, studentId, score);
    }
}
